package org.filetransfer.file_transfer_java_backend.entity;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.persistence.*;
import lombok.*;

import java.time.Instant;
import java.time.LocalDateTime;
@AllArgsConstructor
@NoArgsConstructor
@Builder
@Data
@Entity
@Table(name = "file")
@EqualsAndHashCode(exclude = {"shareItem"})
@Schema(name = "FileInfo", description = "File information entity")
public class File {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;
    @Schema(description = "File name", nullable = false)
    @Column(name = "file_name", nullable = false)
    private String fileName;
    @Schema(description = "File path", nullable = false)
    @Column(name = "file_path", nullable = false)
    private String filePath;
    @Schema(description = "File size", nullable = true)
    @Column(name = "file_size")
    private Long fileSize;
    @Schema(description = "Upload time", nullable = false)
    @Column(name = "upload_time", nullable = false)
    private Instant uploadTime;
    @Column(name = "expiry_time")
    private LocalDateTime expiryTime;
    @Column(name = "download_count", nullable = false)
    private Integer downloadCount;
    @Column(name = "file_md5", nullable = false)
    private String md5;
    @ManyToOne
    @JoinColumn(name = "share_item_id")
    @JsonIgnore
    private ShareItem shareItem;
}
